import request from '@/utils/request'

// 查询路径关系列表
export function listPathRel(query) {
  return request({
    url: '/business/pathRel/list',
    method: 'get',
    params: query
  })
}

// 查询路径关系详细
export function getPathRel(id) {
  return request({
    url: '/business/pathRel/' + id,
    method: 'get'
  })
}

// 新增路径关系
export function addPathRel(data) {
  return request({
    url: '/business/pathRel',
    method: 'post',
    data: {
      ...data,
      pathFormat: data.pathFormat != null ? data.pathFormat.join(',') : null
    }
  })
}

// 修改路径关系
export function updatePathRel(data) {
  return request({
    url: '/business/pathRel',
    method: 'put',
    data: {
      ...data,
      pathFormat: data.pathFormat != null ? data.pathFormat.join(',') : null
    }
  })
}

// 删除路径关系
export function delPathRel(id) {
  return request({
    url: '/business/pathRel/' + id,
    method: 'delete'
  })
}

// 刷新缓存
export function refreshCache() {
  return request({
    url: '/business/pathRel/refreshCache',
    method: 'delete'
  })
}

// 状态变更
export function updateChangeStatus(ids, status){
  return request({
    url: '/business/pathRel/changeStatus',
    method: 'put',
    params: {
      ids: ids,
      status: status
    }
  })
}
